﻿<?
include("../config/header.php");
?>
<script type='text/javascript'>
	document.title = 'HTML转JS代码工具 —— 在线工具';
</script>
<div class="container">
	<div class="panel panel-primary"><div class="panel-heading"><h3 class="panel-title">HTML转JS代码工具</h3></div></div>
	<div class="form-group">
		<label>请将Html源代码粘贴到下面表单中:</label>
		<textarea class="toolarea" id="osource" onfocus="change()" style="width:100%;height:300px;border:1px solid #c5e2f2;overflow:visible;" onkeyup="change()"></textarea>
	</div>
	<div class="form-group">
		<label>下面表单中是相应的Js代码:</label>
		<textarea class="toolarea" id="oresult2"  style="width:100%;height:300px;border:1px solid #c5e2f2;overflow:visible;"></textarea>
	</div>
	<div class="panel panel-primary"><div class="panel-heading"><h3 class="panel-title">JS转HTML代码工具</h3></div></div>
	<div class="form-group">
		<label>请将Js源代码粘贴到下面表单中:</label>
		<textarea class="toolarea" id="oresult" style="width:100%;height:300px;border:1px solid #c5e2f2;overflow:visible;" onfocus="rechange()" onkeyup="rechange()"></textarea>
	</div>
	<div class="form-group">
		<label>下面表单中是相应的Html代码:</label>
		<textarea class="toolarea" id="re" style="width:100%;height:300px;border:1px solid #c5e2f2;overflow:visible;"></textarea>
	</div>
</div>
<script language=JavaScript> 
	 function rechange(){
	 document.getElementById('re').value=document.getElementById('oresult').value.replace(/document.writeln\("/g,"").replace(/"\);/g,"").replace(/\\\"/g,"\"").replace(/\\\'/g,"\'").replace(/\\\//g,"\/").replace(/\\\\/g,"\\")
	 }
	 function change(){
	 document.getElementById('oresult2').value="document.writeln(\""+document.getElementById('osource').value.replace(/\\/g,"\\\\").replace(/\\/g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\n').join("\");\ndocument.writeln(\"")+"\");"
	 }
 </script>
<?php
include("../config/footer.php");
?>